<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AlterSysConfigTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('sys_config', function (Blueprint $table) {
            $table->string('module',20)->comment('模块');
            $table->string('name',20)->comment('模块名字');
            $table->string('version',20)->default('v1.0')->comment('版本号，标记最后一次更改的版本号');
            $table->string('description')->nullable()->comment('描述');
            $table->json('setting')->comment('配置项');
            $table->smallInteger('sort')->default(0)->comment('分模块排序');
            $table->smallInteger('disabled')->default(1)->comment('禁用开关');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('sys_config', function (Blueprint $table) {
            $table->dropColumn(['module','name','version','description','setting','sort','disabled']);
            $table->dropTimestamps();
        });
    }
}
